package com.huey.utils.design.creation.respon;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.ParseException;
import java.util.Date;

/**
 * @author xubo
 * @date 2022/8/5 10:06
 */
public class Test {

    public static void main(String[] args) throws ParseException {
        AuthLink authLink = new Level3AuthLink("1000013", "王工")
                .appendNext(new Level2AuthLink("1000012", "张经理")
                        .appendNext(new Level1AuthLink("1000011", "段总")));

        System.out.println("测试结果：{}"+JSON.toJSONString(authLink.doAuth("小傅哥", "1000998004813441", new Date())));

/*        // 模拟三级负责人审批
        AuthService.auth("1000013", "1000998004813441");
        System.out.println(("测试结果：{}"+"模拟三级负责人审批，王工"));
        System.out.println(("测试结果：{}"+JSON.toJSONString(authLink.doAuth("小傅哥", "1000998004813441", new Date()))));

        // 模拟二级负责人审批
        AuthService.auth("1000012", "1000998004813441");
        System.out.println(("测试结果：{}"+ "模拟二级负责人审批，张经理"));
        System.out.println(("测试结果：{}"+ JSON.toJSONString(authLink.doAuth("小傅哥", "1000998004813441", new Date()))));*/

        // 模拟一级负责人审批
        AuthService.auth("1000011", "1000998004813441");
        System.out.println(("测试结果：{}"+ "模拟一级负责人审批，段总"));
        System.out.println(("测试结果：{}"+ JSON.toJSONString(authLink.doAuth("小傅哥", "1000998004813441", new Date()))));
    }
}
